package com.example.demo.entity;

import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import com.mybatisflex.core.keygen.KeyGenerators;
import lombok.Data;

import java.time.LocalDateTime;

@Data
@Table("tb_order")
public class Order {
    // @Id(keyType = KeyType.Generator, value = "flexId") // id 不要设为int，要不报超出范围
    // (keyType = KeyType.Generator, value = "flexId") // 全局配置里已配置也可
    // @Id(keyType = KeyType.Generator, value = KeyGenerators.snowFlakeId)
    // @Id(keyType = KeyType.Generator, value = "hashcode") // 自定义id生成器 // 负值
    @Id(keyType = KeyType.Generator, value = KeyGenerators.snowFlakeId) // keyType = KeyType.None 可以不写，默认就是None
    @Column(value = "order_id") // 字段不同时用
    private Long id;
    private LocalDateTime createTime;
}
